# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=m4
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.4.17
pkgrel=1
pkgdesc="The GNU macro processor (mingw-w64)"
arch=('any')
url="https://www.gnu.org/software/m4"
license=('GPL3')
source=(https://ftp.gnu.org/gnu/m4/${_realname}-$pkgver.tar.xz{,.sig})
sha256sums=('f0543c3beb51fa6b3337d8025331591e0e18d8ec2886ed391f1aade43477d508'
            'SKIP')

prepare() {
  cd ${srcdir}/${_realname}-$pkgver
}

build() {
  cd ${srcdir}/${_realname}-$pkgver
  ./configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --sysconfdir=${MINGW_PREFIX}/etc \
    --localstatedir=${MINGW_PREFIX}/var \
    --with-syscmd-shell=cmd.exe
  make
}

check() {
  cd ${srcdir}/${_realname}-$pkgver
  make check
}

package() {
  cd ${srcdir}/${_realname}-$pkgver
  make prefix=${pkgdir}${MINGW_PREFIX} install
}
